package cn.wfmiss.spring6.iocxml.bean;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: wfmiss
 * @Date: 2023/12/31/11:56
 * @Description:
 */
public class TestDao {
    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml");

        // 根据类型获取接口对应bean
        // UserDao userDao = context.getBean(UserDao.class);
        UserDaoImpl userDaoImpl = context.getBean(UserDaoImpl.class);
        System.out.println(userDaoImpl);
        userDaoImpl.run();

        PersonDaoImpl personDaoImpl = context.getBean(PersonDaoImpl.class);
        System.out.println(personDaoImpl);
        personDaoImpl.run();

    }
}
